package com.bdqn.systems.controller;


import com.bdqn.response.Result;
import com.bdqn.systems.entity.Department;
import com.bdqn.systems.service.DepartmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cp
 * @since 2020-11-30
 */
@RestController
@RequestMapping("/systems/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @ApiOperation(value = "查找部门并计算人数数", notes = "根据用户查找部门并计算人数数")
    @GetMapping("findDeptAndCount")
    public Result findDeptAndCount(){
        List<Department> deptAndCount = departmentService.findDeptAndCount();
        return Result.ok().data("departments",deptAndCount);
    }
}

